<template>
  <!-- ant-design i18n -->
  <a-config-provider :locale="locale">
    <router-view></router-view>
  </a-config-provider>
</template>

<script lang="ts">
  import en from 'ant-design-vue/es/locale/en_US'
  import zh from 'ant-design-vue/es/locale/zh_CN'
  import ja from 'ant-design-vue/es/locale/ja_JP'
  import moment from 'moment'
  // default en
  import 'moment/dist/locale/zh-cn'
  import 'moment/dist/locale/ja'

  import {
    useStore
  } from 'vuex'

  export default {
    name: 'APP',
    data:()=>{
      return{
        store:useStore()
      }
    },
    computed: {
      locale: function () {
        window.localStorage.setItem('lang', this.$i18n.locale)
        moment.locale(this.$i18n.locale)
        switch (this.$i18n.locale) {
          case 'en':
            return en
          case 'zh':
            return zh
          case 'ja':
            return ja
          default:
            return en
        }
      }
    },
    created(){
      this.store.dispatch('initPrimaryColor')
    }
  }
</script>

<style lang="less">
  // @import './assets/css/theme/default';
  // @import './assets/css/theme/dark';

  // @import 'ant-design-vue/dist/antd.less';

  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
  }
</style>